{% extends "departments/base.html" %}
<!-- stylesheet -->
{% load static %}
{% block title %}
  社团动态
{% endblock %}
{% block departments-external %}
{% endblock %}]

         {% block logo %}
          <a href="{% url 'overview:index' %}" title="极客协会"><img src="https://pic.downk.cc/item/5ebf6257c2a9a83be59950c4.png" width="120" height="120" border="0" alt="极客协会" title="极客协会"></a><!--#endeditable-->
         {% endblock %}
{% block department %}
  <div class="bottom-header blog">
      <div class="row">
        <div class="col-sm-12">
          <h2>社团动态</h2>
        </div>
      </div>
    </div>
{% endblock %}
{% block introduction %}
<div class="container">
    <div class="body_messages_lead" style="height:30px;margin-top:10px;display:inline-block">
            <ol class="breadcrumb">
                <li><a href="{% url 'departments:association_posts' %}?order=recent">最新</a></li>
                <li class="active"><a href="{% url 'departments:association_posts' %}?order=popular">最热</a></li>
            </ol>
        </div>
    {% if user %}
        <div class="body_messages_write" style="height:30px;margin-top:10px;display:inline-block;float:right">
            <a href="{% url 'departments:add_association_post' %}" style="text-align:center;float:right;overflow">
                <button type="button" class="btn btn-success">写文章</button>
            </a>
</div>
    {% endif %}

  <div class="row">
      <div class="row container" style="height:50px;margin-left:0px;margin-top:0px;display:inline-block">
        <div class="col-auto mr-auto col-md-offset-8" >
            <div id="sidebar" style="height:50px;margin-left:0px;margin-top:10px;display:inline-block">
            <div class="widget widget_search" >
<div class="widget-title">
    <h3>本站搜索</h3>
            <form role="search" method="get" class="search-form" action="#"><div class="search-form-box">
  <input type="submit" id="searchsubmit" value="">
  <input type="search" id="s" placeholder="Search..." value="" name="kw" title="搜索">
</div></form>
        </div>
    </div>
        </div>
          </div>
      </div>
    <div class="col-sm-8" style="margin-top:50px">
      <section id="blog">
{% for x in association_posts %}
<article class="blog-post catalogue">
<a title="{{x.title}}" class="blog-post-title" href="{% url 'departments:association_post_info' x.id %}"> {{x.title}} </a>
<div class="blog-post-meta">
    <span class="post-meta-time"><i class="fa fa-calendar"></i>{{x.created_time}} </span>
    <span class="post-meta-categories"><i class="fa fa-folder-o"></i> {{x.association}} </span>
    <span class="post-meta-time"><i class="fa fa-eye"></i>{{x.nov}} </span>
</div>
<div class="blog-post-entry">
<p>{{x.desc|slice:100}}...</p>
</div><a title="{{x.title}}" class="blog-post-button" href="{% url 'departments:association_post_info' x.id %}">read more</a>
<hr>
</article>
{% endfor %}
{% if not association_posts %}
<article class="blog-post catalogue">
<a title="暂无" class="blog-post-title" href="#"> 暂无 </a>
<div class="blog-post-meta">
    <span class="post-meta-time"><i class="fa fa-calendar"></i>
 时间 </span>
    <span class="post-meta-categories"><i class="fa fa-folder-o"></i> 新闻动态 </span>
</div>
<div class="blog-post-entry">
<p>暂无</p>
</div><a title="暂无" class="blog-post-button" href="#">read more</a>
<hr>
</article>
{% endif %}
</section></div>

</div>
</div>
{% if association_posts %}
<div style="text-align:center">
<div class="pagination row">
        <div class="m-auto">
        <span class="step-links">
            <!-- 如果不是第一页，则显示上翻按钮 -->
            {% if association_posts.has_previous %}
                <a href="?page=1&order={{order}}&kw={{ kw }}" class="btn btn-success">
                    &laquo; 1
                </a>
                <span>...</span>
                <a href="?page={{ association_posts.previous_page_number }}&order={{order}}&kw={{ kw }}"
                   class="btn btn-secondary"
                >
                    {{ association_posts.previous_page_number }}
                </a>
            {% endif %}

            <!-- 当前页面 -->
            <span class="current btn btn-danger btn-lg">
                {{ association_posts.number }}
            </span>

            <!-- 如果不是最末页，则显示下翻按钮 -->
            {% if association_posts.has_next %}
                <a href="?page={{ association_posts.next_page_number }}&order={{order}}&kw={{ kw }}"
                   class="btn btn-secondary"
                >
                    {{ association_posts.next_page_number }}
                </a>
                <span>...</span>
                <a href="?page={{ association_posts.paginator.num_pages }}&order={{order}}&kw={{ kw }}"
                   class="btn btn-success"
                >
                    {{ association_posts.paginator.num_pages }} &raquo;
                </a>
            {% endif %}
        </span>
        </div>
</div>
    </div>
{% endif %}
<!--
<div class="body_messages_page">
            <div align="center">
                <nav aria-label="Page navigation">
                    <ul class="pagination">
                        <li>
                            <a href="#" aria-label="Previous">
                                <span aria-hidden="true">&laquo;</span>
                            </a>
                        </li>
                        <li><a href="#">一</a></li>
                        <li><a href="#">二</a></li>
                        <li><a href="#">三</a></li>
                        <li><a href="#">四</a></li>
                        <li><a href="#">五</a></li>
                        <li>
                            <a href="#" aria-label="Next">
                                <span aria-hidden="true">&raquo;</span>
                            </a>
                        </li>
                    </ul>
                </nav>
            </div>
        </div>
        -->
{% endblock %}
